#include "stdafx.h"

#include "Observer.h"
#include "WeatherStation.h"

#include <time.h>

int main(int argc, char * argv[])
{
    std::shared_ptr<Observer> observer(new Observer());
	
    WeatherStation weatherStation;
	weatherStation.RegisterObserver(observer);
    
    time_t t1 = time(NULL);
    time_t t2 = time(NULL);
    
    srand (time(NULL));
	while (true)
	{
        t2 = time(NULL);
        if (t2 - t1 > 3)
        {
            weatherStation.NotifyObserver(rand() % 10, rand() % 10, rand() % 10);
            observer->Display();
            t1 = t2;
        }
	}
	//std::shared_ptr<Observer> observer(new Observer());
    weatherStation.RemoveObserver(observer);
	
    return 0;
}

